//
//  ViewController.m
//  picexplorer
//
//  Created by student on 16/2/19.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSMutableArray *arr = [[NSMutableArray alloc]init];
    UIImage *image1 = [UIImage imageNamed:@"biaoqingdi"];
    UIImage *image2 = [UIImage imageNamed:@"bingli"];
    UIImage *image3 = [UIImage imageNamed:@"chiniupa"];
    UIImage *image4 = [UIImage imageNamed:@"danteng"];
    UIImage *image5 = [UIImage imageNamed:@"wangba"];
    [arr addObject:image1];
    [arr addObject:image2];
    [arr addObject:image3];
    [arr addObject:image4];
    [arr addObject:image5];
    self.imageview.image = arr[0];
    self.countfield.text = @"1/5";
    self.scribefield.text = @"这是第1张图";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.

}

- (IBAction)leftbtn:(UIButton *)sender
{
    NSMutableArray *arr = [[NSMutableArray alloc]init];
    UIImage *image1 = [UIImage imageNamed:@"biaoqingdi"];
    UIImage *image2 = [UIImage imageNamed:@"bingli"];
    UIImage *image3 = [UIImage imageNamed:@"chiniupa"];
    UIImage *image4 = [UIImage imageNamed:@"danteng"];
    UIImage *image5 = [UIImage imageNamed:@"wangba"];
    [arr addObject:image1];
    [arr addObject:image2];
    [arr addObject:image3];
    [arr addObject:image4];
    [arr addObject:image5];
    if (self.countfield.tag > 0)
    {
        self.countfield.tag -= 1;
        int i = self.countfield.tag;
        self.imageview.image = arr[i];
        self.countfield.text = [NSString stringWithFormat:@"%ld/5",self.countfield.tag+1];
        self.scribefield.text = [NSString stringWithFormat:@"这是第%ld张图",self.countfield.tag+1];
    }
}

- (IBAction)rightbtn:(UIButton *)sender
{
    NSMutableArray *arr = [[NSMutableArray alloc]init];
    UIImage *image1 = [UIImage imageNamed:@"biaoqingdi"];
    UIImage *image2 = [UIImage imageNamed:@"bingli"];
    UIImage *image3 = [UIImage imageNamed:@"chiniupa"];
    UIImage *image4 = [UIImage imageNamed:@"danteng"];
    UIImage *image5 = [UIImage imageNamed:@"wangba"];
    [arr addObject:image1];
    [arr addObject:image2];
    [arr addObject:image3];
    [arr addObject:image4];
    [arr addObject:image5];

    if (self.countfield.tag < 4)
    {
        self.countfield.tag += 1;
        int i = self.countfield.tag;
        self.imageview.image = arr[i];
        self.countfield.text = [NSString stringWithFormat:@"%ld/5",self.countfield.tag+1];
        self.scribefield.text = [NSString stringWithFormat:@"这是第%ld张图",self.countfield.tag+1];
    }
}
@end
